<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div>
    <el-form ref="form" :model="t_send" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="$parent.$parent.popSendEmail('')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 消息 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="主题" prop="subject">
              {{t_send.subject}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="正文" prop="message">
              {{t_send.message}}
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 发送结果 </span>
      </div>
      <el-table :data="s_recipient">
        <el-table-column label="邮箱" prop="sendto">
        </el-table-column>
        <el-table-column label="发送时间" prop="entered">
          <template slot-scope="scope">
            {{getDateTimeString(scope.row,'entered')}}
          </template>
        </el-table-column>
      </el-table>
      <div class="form-unit">
        <span class="mvc-title-left"> 附件 </span>
      </div>
      <el-table :data="s_file">
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="popOutboxDetailed('&fileverid='+scope.row.verson_id+'')">查看文件</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="gotoPage('/xcapi/ProcessFile/DownloadFile.do?&fileverid='+scope.row.verson_id+''+vueparams+'')">下载文件</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="文件" prop="client_filename">
        </el-table-column>
        <el-table-column label="名称" prop="filename">
        </el-table-column>
      </el-table>
      <el-button @click="$parent.$parent.popSendEmail('')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
    </el-form>
    <el-dialog :visible.sync="OutboxDetailedVisible" append-to-body>
      <OutboxDetailed v-if="OutboxDetailedVisible" ref="OutboxDetailed" :popparams="popparams"> </OutboxDetailed>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import OutboxDetailed from "@/views/oa/communication/OutboxDetailed";
  export default {
    name: 'OutboxDetailed',
    components: {
      OutboxDetailed,
    },
    props: ['popparams'],
    data() {
      return {
        OutboxDetailedVisible: false,
        OutboxDetailedValue: null,
        OutboxDetailedDesc: null,
        vueparams: this.getVUEParams(""),
        t_send: {
          subject: null,
          message: null,
        },
        s_recipient: [],
        s_file: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/oa/communication/EmailAction/outboxDetailed?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      popOutboxDetailed(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.OutboxDetailedVisible = !this.OutboxDetailedVisible;
      },
    },
  }
</script>
